package com.edu.exam.enums.grading;

import com.edu.exam.enums.core.BaseEnum;

/**
 * 专家等级枚举
 *
 * @author System
 * @version 1.0.0
 * @since 2025-11-13
 */
public enum ExpertiseLevel implements BaseEnum {

    /** 无专家 */
    NONE("NONE", "无专家"),

    /** 初级 */
    JUNIOR("JUNIOR", "初级"),

    /** 中级 */
    INTERMEDIATE("INTERMEDIATE", "中级"),

    /** 高级 */
    SENIOR("SENIOR", "高级"),

    /** 专家 */
    EXPERT("EXPERT", "专家"),

    /** 大师级 */
    MASTER("MASTER", "大师级"),

    /** 传奇级 */
    LEGENDARY("LEGENDARY", "传奇级");

    private final String code;
    private final String description;

    ExpertiseLevel(String code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public static ExpertiseLevel fromCode(String code) {
        for (ExpertiseLevel expertise : values()) {
            if (expertise.getCode().equals(code)) {
                return expertise;
            }
        }
        throw new IllegalArgumentException("Unknown ExpertiseLevel code: " + code);
    }

    @Override
    public String toString() {
        return description;
    }
}